package cn.kk.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@RestController
public class Starter implements WebMvcConfigurer {
	public static void main(String[] args) {
		SpringApplication.run(Starter.class, args);
	}
	//配置当前工程的默认首页
	/*@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		//内置的controller处理项目访问的"/",默认首页
		registry.addViewController("/").setViewName("index");
		//当前的处理"/"是所有controller转发的最高级,有相同controller编写
		//无效
		registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
		super.addViewControllers(registry);
	}*/
	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/").setViewName("forward:/index.jsp");
		WebMvcConfigurer.super.addViewControllers(registry);
	}
}
